<template>
  <el-menu
    default-active="1-1"
    class="el-menu-vertical-demo"
    @select="handleSelect"
  >
    <el-sub-menu index="1">
      <template #title>
        <el-icon><Histogram /></el-icon>
        <span>营业数据</span>
      </template>
        <el-menu-item index="1-1">营业流水</el-menu-item>
        <el-menu-item index="1-2">菜品销量</el-menu-item>
    </el-sub-menu>
    <el-menu-item index="2" >
      <el-icon><Dish /></el-icon>
      <span>菜品管理</span>
    </el-menu-item>
    <el-menu-item index="3">
      <el-icon><Avatar /></el-icon>
      <span>用户管理</span>
    </el-menu-item>
  </el-menu>
</template>

<script  setup>
import { useRouter } from 'vue-router'
const router=useRouter()

const handleSelect = (key, keyPath) => {
  console.log(key, keyPath)
  if(key==='1-1'){
      router.push('/admin/orderData')
  }else if(key==='1-2'){
      router.push('/admin/dishData')
  }else if(key==='2'){
      router.push('/admin/dishAdmin')
  }else if(key==='3'){
      router.push('/admin/userAdmin')
  }
}

</script>